<?php
/**
 * Created by PhpStorm.
 * User: moquan
 * Date: 2018/6/20
 * Time: 18:18
 */

namespace app\admin\validate;


class IDVali extends BaseValidate {

    //定义验证规则
    protected $rule = [
        "id" => "require|isMustInteger|greater:1"
    ];

    protected function greater( $value, $rule, $data, $field ) {
        if ( $value > $rule ) {
            return true;
        }

        return $field.' 必须大于'.$rule;
    }

    //定义验证场景
    protected $scene = [
        //基本
        'basic'  =>  ['require', 'isMustInteger']
    ];
}